<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/cancelledOrders.do"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.sales.Orders,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.User,
                 java.util.ArrayList"%>
<%@ page import="com.scalar.chiptrack.commons.Constants" %>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel=stylesheet>

<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script  language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<SCRIPT language="JavaScript">
    window.onload = init;

    function init()
    {
        qs_1 = new QuickSearch(document.ordersForm['salesOrderId'], document.ordersForm.qs1, false);
        qs_2 = new QuickSearch(document.ordersForm['customerPO'], document.ordersForm.qs2, false);
    }
    function searchOrderList(theForm)
    {
        if(!isInteger(theForm.year.value)) {
            errors = "<li> Please enter a valid integer";
            var pa=document.getElementById("errors1");
            pa.innerHTML = errors;
            theForm.year.select();
            return false;
        }

        theForm.action.value = "SearchOrder";
        //theForm.submit();
        return true;
    }

    function GetAllProducts()
    {
        newWindow = window.open('loadProducts.do','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=500,height=600,resizable=no');
        newWindow.moveTo(300,30);
        newWindow.focus();
    }

    function assignProduct(passedValue)
    {
	document.ordersForm.manufacturingPartNo.value = passedValue;
	window.focus();
    }

    var dateElement = "";
    function openCalendar(dateValue)
    {
	dateElement = dateValue;
  	newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
  	newWindow.moveTo(550,180);
  	newWindow.focus();
    }

    function assignDate(passedValue)
    {
	dateElement.value=passedValue;
	window.focus();
    }

    // SharatH on July 31, 2003
    function showErrorReportPage()
    {
        newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
        newWindow.focus();
    }

</SCRIPT>


<!-- Top Header Start-->

    <%
        String userTypeChiptrac = Constants.USER_TYPE_CHIPTRAC + "";
    %>
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/header.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/extHeader.jsp" %>
    </logic:notEqual>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

<%
 String heading = "";
 String isSample = "1";
%>
<% if((request.getParameter("isSample") != null) && (request.getParameter("isSample").equals("0"))) {
         heading = "Sample Orders"; isSample="0";
%>
	    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
            <%@ include file="/jsp/sales/sample_order_menu.jsp" %>
        </logic:equal>
        <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
            <%@ include file="/jsp/sales/ext_sample_order_menu.jsp" %>
        </logic:notEqual>
<% } else {
     heading = "Sales Orders";isSample="1";
%>
        <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
            <%@ include file="/jsp/sales/sales_order_menu.jsp" %>
        </logic:equal>
        <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
            <%@ include file="/jsp/sales/ext_sales_order_menu.jsp" %>
        </logic:notEqual>
<% } %>

<!-- end of the side navigations -->
</TD>

<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>

<!-- from here your body starts -->
<center><span class="NArialW">Cancelled <%=heading%></span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>
<html:form name="ordersForm" onsubmit="return searchOrderList(document.ordersForm);" method="post" action="/cancelledOrders" type="com.scalar.chiptrack.sales.forms.OrdersForm">
 <table border="0" width="90%" align=right>
 <tr><td>
 <table border="0" width="100%" align=right>

    <tr><td colspan="6"><chiptrack:messages type="error" styleClass="NArialL" /><br></td></tr>
    <tr><td colspan="6"><chiptrack:errors styleClass="NArialL" /><br></td></tr>
    <tr><td colspan='6' align="left" class='NArialL'><FONT id="errors1" color='FF0000'></FONT></TD></TR>
    <tr><td colspan='6' align="left" class='NArialL'>&nbsp;</TD></TR>

    <tr>
      <td width="25%">
	  <!-- Modified by veeru on (03/05/04) 
	  <font class="NArialL">Product Name<br>(Mfg Part Number)</font> -->
  	  <font class="NArialL">Product Name<br>(<bean:message key="label.mfgPartNumber" />)</font>	  
	  </td>
      <td width="15%"><font class="NArialL" colspan=4>
           <html:select name="ordersForm" property="manufacturingPartNo" styleClass="txfield">
                <html:options collection="productList" property="value" labelProperty="label"/>
           </html:select>
      </td>
      <td width="10%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Customer</font></td>
      <td width="15%"><font class="NArialL">
        <html:select name="ordersForm" property="customerId" styleClass="txfield">
            <html:options collection="customerList" property="value" labelProperty="label"/>
        </html:select>
      </td>

    </tr>
     <tr>
      <td width="25%"><font class="NArialL">Quick Search Sales Order #</font></td>
      <td width="15%">
        <input type="text" name="qs1" class="txfield" size='20' onkeyup='quickSearch(qs_1);'/>
      </td>
      <td width="10%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Quick Search Customer PO #</font></td>
      <td width="15%">
            <input type="text" name="qs2" class="txfield" size='20' onkeyup='quickSearch(qs_2);'/>
      </td>
    </tr> 
    <tr>
      <td width="25%"><font class="NArialL">Sales Order #</font></td>
      <td width="15%"><font class="NArialL">
          <html:select name="ordersForm" property="salesOrderId" styleClass="txfield">
            <html:options collection="salesOrdersList" property="value" labelProperty="label"/>
        </html:select>
      <%--<html:text name="ordersForm" property="salesOrderId" size="20" styleClass="txfield" />--%></td>
      <td width="10%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Cuutomer PO #</font></td>
      <td width="15%">
        <html:select name="ordersForm" property="customerPO" styleClass="txfield">
            <html:options collection="posList" property="value" labelProperty="label"/>
        </html:select>
      </td>
    </tr>
    <tr>
      <td width="25%"><font class="NArialL">&nbsp;</font></td>
      <td width="15%"><font class="NArialL">&nbsp;</font></td>
      <td width="10%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Year</font></td>
      <td width="15%">
        <html:select name="ordersForm" property="year" styleClass="txfield">
            <html:option value="">--All--</html:option>
            <html:options collection="years" property="value" labelProperty="label" />
        </html:select>
      </td>
    </tr>

    <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
    <tr>
      <td colspan=5 align=center>

       <%--  <a href="javascript:searchOrderList(document.ordersForm);" onmouseover="window.status='Click to Search for Sales Orders List';return true" onmouseout="window.status='';return true" title="Click here to Search for Sales Orders List"><input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17"></a> --%>
           <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search for Sales Orders List';return true" onmouseout="window.status='';return true" title="Click here to Search for Sales Orders List"/>
           <a href="javascript:document.ordersForm.reset();" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true"title="Click here to Reset">
           <img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a></td>
    </tr>
   </table>
   </td></tr>
   <tr><td><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
   <tr><td>
   <logic:equal name="showList" value="TRUE">
   <table border="0" width="100%" bordercolor="#FFFFFF" align=right>
	<tr>
	  <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Sales Order #</font></td>
	  <td width="25%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Customer Name</font></td>
	  <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Booking Date</font></td>
	  <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Actions</font></font></td>
	</tr>
        <% int bgcount = 0;%>
        <!--Bhaskar added this scriptlet on 14 july 2003-->
        <% ArrayList rowDetails = (ArrayList)request.getAttribute ( "cancelledList" ); %>
        <tr><td colspan=4></td></tr>
	<logic:iterate id="Orders" name="cancelledList">
        <% Orders orderItem = (Orders)rowDetails.get( bgcount );
            int salesOrder_Id = orderItem.getSalesOrderId(); %>
        <% bgcount = bgcount + 1; %>
	<tr>
	  <td width="10%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="Orders" property="salesOrderNo"  /></font></td>
	  <td width="25%" align="left" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="Orders" property="customerName" /></font></td>
	  <td width="15%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="Orders" property="bookingDate" /></font></td>
          <td width="15%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
            <!--Bhaskar commented this link on 14 july 2003-->
		<A HREF="<%=chipTracContext%>/order.do?action=cancelledOrder&salesOrderId=<bean:write name="Orders" property="salesOrderId"/>&isSample=<%=isSample%>" onmouseover="window.status='Click to View Cancelled Sales Order';return true" onmouseout="window.status='';return true" >View </A>
                <!--This link is added by Bhaskar-->
                <!-- chiptrack : restrictedLink functionality='< %=Functionality.SALES_CANCELLED_ORDER%>' action='< %=User.USER_ACTION_VIEW%>' styleClass="leftsection" href='<%=chipTracContext + "/cancelledOrders.do?salesOrderId=" + salesOrder_Id + "&isSample=" + isSample%>' onmouseover="window.status='Click to view sales order';return true" onmouseout="window.status='';return true">View</chiptrack : restrictedLink-->
		</font></td>
	</tr>
        </logic:iterate>
    </table>
    </logic:equal>
    </td></tr>
</table>

<input type="hidden" name="action" value="">
<input type="hidden" name="isSample" value="<%=request.getParameter("isSample")%>">
</html:form>


<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->

</BODY>
</HTML>
